package com.mayikt.mapper;

import com.mayikt.entity.UserDO;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Name UserMapper
 * @Author 枫火
 * @Date 2021/5/25 19:52
 * @Description
 **/
public interface UserMapper {

    @Update("\n" +
            "update meite_user set WX_OPENID=#{wxOpenId}  where user_id=#{userId};")
    int updateUseOpenId(@Param("userId") Long userId, @Param("wxOpenId") String wxOpenId);

    @Select("SELECT USER_ID AS USERID ,MOBILE AS MOBILE ,password as password\n" +
            ",user_name as username ,user_name as username,sex as sex \n" +
            ",age as age ,create_time as createtime,IS_AVAILABLE as ISAVAILABLE\n" +
            ",\n" +
            "pic_img  as picimg,qq_openid as qqopenid ,wx_openid as wxopenid\n" +
            "\n" +
            "from meite_user where trim(WX_OPENID)!=''  limit #{index},#{pageSize}; ")
    List<UserDO> selectByOpenIdNotIsNull(@Param("index") Integer index, @Param("pageSize") Integer pageSize);
}